// 快检主体

import request from '@/utils/request'

// 快检主体
export function getInspection(params) {
  return request({
    url: '/baseTrace/intercourseEnterprise.do?action=list&delayBigDataQuery=true',
    method: 'post',
    params
  })
}

// 选择采样人员
export function selectCheckPerson(params) {
  return request({
    url: '/baseTrace/employee.do?action=list&type=fastCheckPerson&roleCodeIn=sampler,manager,samplerAndInspector&templateCode=TEMPLATE_LIST_CYRYGL',
    method: 'post',
    params
  })
}

// 选择样品
export function selectSample(params) {
  return request({
    url: '/baseTrace/businessVariety.do?action=list&buildControls=BUSINESS_BELONG_VARIETY_TYPE_INFO&type=sampleProduct',
    method: 'post',
    params
  })
}

// 选择所属市场
export function selectMarket(params) {
  return request({
    url: '/base/entManage.do?action=marketList&page=1&limit=10',
    method: 'post',
    params
  })
}

// 获取经营范围
export function getBusinessScope(params) {
  return request({
    url: '/baseTrace/varietyType.do?action=getTree',
    method: 'post',
    params
  })
}

// 选择进货单号
export function getPurchaseList(params) {
  return request({
    url: '/fastCheck/bill.do?action=findInBillInfo&stateNotEqual=CANCEL',
    method: 'post',
    params
  })
}

// 立即采样-提交
export function postSampling(params) {
  return request({
    url: '/bill.do?action=save',
    method: 'post',
    params
  })
}

// 详情
export function getSubjectDetail(params) {
  return request({
    url: '/baseTrace/intercourseEnterprise.do?action=get',
    method: 'post',
    params
  })
}

// 详情 通过code
export function getSubjectDetailByCode(code) {
  return request({
    url:
      '/baseTrace/enterpriseInfo.do?action=getByCode&buildControls=BUILD_RELATION_PLACE_INFO&code=' +
      code,
    method: 'post'
  })
}

// 新增往来单位
export function newCorrespondent(params) {
  return request({
    url: '/base/sampling.do?action=generateSampling',
    method: 'post',
    params
  })
}

// 快检记录
export function getInspectRecord(params) {
  return request({
    url: '/bill.do?action=list&type=SampleBill&buildControls=BUILD_REPORT_INFO',
    method: 'post',
    params
  })
}

// 获取主体列表
export function getSubjectList(params) {
  return request({
    url: '/base/entManage.do?action=list',
    method: 'post',
    params
  })
}

// 新增
export function saveInspectSubject(params) {
  return request({
    url: '/baseTrace/intercourseEnterprise.do?action=save',
    method: 'post',
    params
  })
}
